package com.mbc.controller;


import com.mbc.comment.Result;
import com.mbc.service.SignInService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户签到表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-04-09
 */
@RestController
@RequestMapping("/signin")
@Api(tags = "用户签到接口")
@CrossOrigin
public class SignInController {

    @Autowired
    private SignInService signInService;

    /**
     * 每天用户签到
     *
     * @param userId 用户 ID
     * @return {@link Result}<{@link Boolean}>
     */
    @PostMapping("/{userId}")
    @ApiOperation("每天用户签到")
    public Result<Boolean> selectUserSignIn(@PathVariable String userId){
        if (signInService.getSelectUserSignIn(userId)){
            return Result.success(true);
        }
        return Result.error("0");
    }
}
